<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Test2</title>
</head>
<body>
</body>
<script>
    // 创建变量
    var name = '九转苍翎';
    console.log(name);
    let age = 10;
    console.log(age);
    console.log('====================================');
    //动态类型
    let a = "a";;
    console.log(typeof(a));
    a = 10;
    console.log(typeof(a));
    console.log('====================================');
    //基本数据类型
    //1.number数字类型
    let number1 = 0o7;//八进制
    console.log(number1);
    let number2 = 0xf;//十六进制
    console.log(number2);
    let number3 = 0b1;//二进制
    console.log(number3);
    let number4 = 10 / 0;
    console.log(number4);
    let number5 = -10 / 0;
    console.log(number5);
    let number6 = 'ABC' - 1;
    console.log(number6);
    console.log('====================================');
    //2.string类型
    let string1 = '九转苍翎"逆天而行"';
    console.log(string1);
    console.log(string1.length);//string长度
    let string2 = "九转苍翎'逆天而行'";
    console.log(string2);
    console.log(string2.length);
    console.log(string1 + string2);//string拼接
    console.log((string1 + string2).length);
    console.log('====================================');
    //3.boolean类型
    console.log(true);
    console.log(typeof(true));
    console.log(true + 1);
    console.log(typeof(true + 1));
    console.log(false + 1);
    console.log(typeof(false + 1));
    console.log('====================================');
    //4.undefined类型
    let undefined1;
    console.log(undefined1);
    console.log(undefined1 + 1);
    console.log(undefined1 + "1");
    console.log(undefined1 + true);
    console.log('====================================');
    //5.null数据类型
    let null1 = null;
    console.log(null1);
    console.log(null1 + 1);
    console.log(null1 + "1");
    console.log(null1 + true);
    console.log('====================================');
    //6.==
    let x = 10;
    let y = "10";
    console.log(x == y);//会进行隐式类型转换
    console.log(x === y);//不会进行隐式类型转换
</script>
</html>